import sys
op=map(int,input().split(','))
list=[]
for i in op:
    list.append(i)

if len(list) < 2:
    print('n至少为2')
    sys.exit(0)

def mianji(a,b):
    high = min(list[a],list[b])
    side = abs(a-b)
    return high*side

areas = []

i=0
while i<len(list):
    for j in range(i+1,len(list)):
        areas.append(mianji(i,j))
    i+=1

sortAreas = sorted(areas)
print(sortAreas[-1])


